Skip to content

Fix dropped images in Anthropic tool results - #73

Open
PhunsukhWangdu2002 wants to merge 1 commit into
MAXeaglet:masterfrom
PhunsukhWangdu2002:fix/anthropic-tool-result-images
Open

PhunsukhWangdu2002 wants to merge 1 commit into
MAXeaglet:masterfrom
PhunsukhWangdu2002:fix/anthropic-tool-result-images

Conversation

@PhunsukhWangdu2002

Copy link
Copy Markdown

How this surfaced

Claude Code fell back to OCR when asked to inspect a local image through the Command Code proxy on macOS, while DSH could send images through the same proxy. A text-free two-color PNG isolated two separate issues: switching Claude to the vision-capable DeepSeek V4.1 Flash route made direct image attachments work through Anthropic Messages, but the Anthropic converter still discarded image blocks nested inside tool_result because it only extracted text.

What changed

Preserve tool-result text and IDs, then forward the extracted images as native image blocks in a user message after all tool results in that batch. The Anthropic path now applies the existing tool-image size limits and per-request budget. A regression test checks that parallel tool results remain adjacent and that the image reaches the upstream payload as an image.

Validation

  • npm test on macOS: 147 tests passed.
  • Live macOS API check: the same text-free image was correctly described as green on the left and blue on the right, both as a direct attachment and as a tool result. Both the direct Anthropic Messages route used by VS Code and the CC Switch gateway route used by Claude Desktop returned the expected result with DeepSeek V4.1 Flash.
  • The OpenAI Chat Completions route used by DSH also passed the image check.

The live checks exercised the configured API routes directly, without driving the desktop UI. Client model configuration is outside the scope of this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant